#ifndef __SINGLETON_H__
#define __SINGLETON_H__

namespace wild
{

template < typename T >
class Singleton
{
public:
	Singleton()
	{
		
	}
	
	virtual ~Singleton()
	{
		if( !m_Instance )
		{
			delete m_Instance;			
			m_Instance = 0;
		}
	}
	
	static T* Instance()
	{
		if( !m_Instance )
		{
			m_Instance = new T;
		}
		
		return m_Instance;
	}
	
private:
	static T* m_Instance;
};

template< typename T>
T* Singleton< T >::m_Instance = 0;


}	//	namespace wild

#endif	//	__SINGLETON_H__
